package com.vaadin.thomas.contenttool.demo;

import com.vaadin.thomas.contenttool.ui.events.LangChangedEvent;
import com.vaadin.thomas.contenttool.ui.events.LangChangedListener;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;

public class TabContent extends VerticalLayout implements LangChangedListener {

	private static final long serialVersionUID = -2879304397982774558L;

	private Label content;
	private String id;

	public TabContent(String tab) {
		id = tab;

		Contenttool_demoApplication.blackboard().addListener(this);

		content = new Label();
		addComponent(content);

		setMargin(true);

		langChanged(null);
	}

	public void langChanged(LangChangedEvent event) {
		content.setValue(Contenttool_demoApplication.contenttool().get(
				"demo." + id + ".value"));
	}

	@Override
	public String getCaption() {
		return Contenttool_demoApplication.contenttool().get(
				"demo." + id + ".caption");
	}

}
